from django.db import models

# Create your models here.

class Message(models.Model):
    title = models.CharField(max_length=20)


class MessageUser(models.Model):
    user_id = models.IntegerField(11, default=1)
    message_id = models.ForeignKey(Message)



class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField()

    def __unicode__(self):
        return '%s, %s' % (self.first_name, self.last_name)



class Book(models.Model):
    title = models.CharField(max_length=200)
    authors = models.ManyToManyField(Author)

    def __unicode__(self):
        return self.title